x, a, b, c, d = map(float, input().split())
result = a * x ** 3 + b * x ** 2 + c * x + d
print(f"{result:.7f}")